package com.dream.myqiyi.search;

import java.util.List;

import com.dream.myqiyi.R;
import com.dream.myqiyi.search.GudingzichanAdapter.ViewHolder;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class XianjinAdapter extends BaseAdapter{

	 private static final String TAG="XianjinAdapter";
	   private Context context;
	   public List<XianjinObject> showlist=null;

	    public XianjinAdapter(Context context, List<XianjinObject> list){
	       this.showlist =list;
		   this.context=context;

	   }
	
	@Override
	public int getCount() {
		return showlist.size();
	}

	@Override
	public Object getItem(int position) {
		return showlist.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		ViewHolder holder;
        if (convertView != null) {
	        	holder = (ViewHolder) convertView.getTag();  
	        } else {  
	        	LayoutInflater mInflater=LayoutInflater.from(context);
	        	convertView= mInflater.inflate(R.layout.caiwujihua_item_view, null);
	            holder = new ViewHolder(); 
	            holder.planname = (TextView) convertView.findViewById(R.id.caiwu_showplanname);
	            holder.areaname= (TextView) convertView.findViewById(R.id.caicu_showareaname);
               holder.currentleve=(TextView)convertView.findViewById(R.id.caicu_showcurrentlevel);
	            convertView.setTag(holder);
	            
	        }

           XianjinObject dudingObject=showlist.get(position);
           holder.planname.setText(dudingObject.getSummary());
           holder.areaname.setText(dudingObject.getMoney());
           holder.currentleve.setText(dudingObject.getUnitname());

	       return convertView; 
	}
	/** Creates a ViewHolder and store references to the related children views
	 */  
	    class ViewHolder {
	        TextView planname;
	        TextView areaname;
            TextView currentleve;

	    }
}
